package week2;

import java.util.Arrays;
import java.util.ArrayList;
import java.util.Scanner;

public class week2_01 
{

	public static int fib(int num)
	{
		if(num==1||num==2)
			return 1;
		
		return fib(num-1)+fib(num-2);
		
	}
	
	public static void search(int n)
	{
		
	}

	static int[] num4;
	
	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		Main t = new Main();

		while(true){

			String str = sc.next();
			switch (str) 
			{
			
			case "fib":
				int num = sc.nextInt();
				for(int i=1;i<num;i++)
				{
					System.out.print(t.fib(i)+" ");
				}
				System.out.println(t.fib(num));
				break;
				
				
			case "sort":
				sc.nextLine();
				String num2 = sc.nextLine();
				String[] num3 = num2.split(" ");
				num4 = new int[num3.length]; 
				for(int i=0;i<num3.length;i++)
				{
					num4[i] = Integer.parseInt(num3[i]); 
				}
				Arrays.sort(num4);
				System.out.println(Arrays.toString(num4));
				break;

			case "search":
				int x = sc.nextInt();
				int a = Arrays.binarySearch(num4, x);
				if(a<0)
					System.out.println("-1");
				else
				    System.out.println(a);
				break;

			case "getBirthDate":
				int n = sc.nextInt();
				for(int i= 0;i<n;i++)
				{
					String id = sc.next();
					String year = id.substring(6, 10);
					String month = id.substring(10, 12);
					String day = id.substring(12, 14);
				    System.out.println(year+"-"+month+"-"+day);
				}
				break;

			default:
				System.out.println("exit");
				break;
			}
		}
	}
}